package com.zq.jichu;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * ArrayList复习
 */
public class ArrayListTest {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("张三");
        list.add("李四");
        list.add("王麻子");
//        System.out.println(list);//[张三, 李四, 王麻子]
//        System.out.println(list.get(1));//李四
//        System.out.println(list.size());//3
//        System.out.println(list.contains("李四"));//true
//        list.forEach(System.out::println);
        /*Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }*/
        /*for (String s : list) {
            System.out.println(s);
        }*/
    }
}
